package stream;

import java.util.Arrays;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class CreateArrayStream {
    public static void main(String[] args) {
        //创建几种数组
        //1.引用类型数组
        Integer[]arr1=new Integer[]{1,2};
        String[]arr2=new String[]{"a","b"};
        //2.普通类型数组
        int[]brr1=new int[]{11,22};
        double[]brr2=new double[]{2.5,1.0};

        //创建数组的流对象
        //=============引用数据类型数组=====================
        //方式一(使用Arrays类中方法获取数组的流对象)
        Stream<Integer> stream1 = Arrays.stream(arr1);
        Stream<String> stream2 = Arrays.stream(arr2);
        //方式二(使用Stream类中的of()方法获取流对象)
        Stream<Integer>stream3=Stream.of(arr1);
        Stream<String>stream4=Stream.of(arr2);

        //=============普通数据类型数组=====================
        //方式一：(使用Arrays工具类进行创建流)
        IntStream stream11 = Arrays.stream(brr1);
        DoubleStream stream = Arrays.stream(brr2);
        //方式二：(使用Stream的of()方法进行流的创建)
        Stream<int[]> brr11 = Stream.of(brr1);
        Stream<double[]> brr22 = Stream.of(brr2);

    }
}
